<!-- 退款明细列表 -->
<template>
    <div>
        <table-list 
        :tableData='tableData'
        :tableInfos ='tableInfos'
        :hasSera='true'
        :tableFormatter='tableFormatter'
        >
        </table-list>
        <el-pagination
            layout="total, sizes, prev, pager, next, jumper"
            style="margin-top:30px"
            :current-page.sync="pageNum"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :total="totalSize">
        </el-pagination>
    </div>
</template>
<script>
import api from '@/api/apiPath'
import tableList from './tableList'
export default {
	components: {
        'table-list':tableList,
        },
	data () {
		return {
            seleArray:[],
            searchName:'',
            
            tableInfos:[
                {label:'跟投单号',prop:'orderNumber'},
                {label:'跟投份数',prop:'number'},
                {label:'跟投额度（元）',prop:'quota'},
                {label:'实付金额（元）',prop:'realAmount'},
                {label:'退款金额（元）',prop:'refundAmount'},
                {label:'退款状态',prop:'status'},
                {label:'退款日期',prop:'refundTime'},
            ],
           
            tableData:[],
            pageNum: 1,
            pageSize: 10,//每页几条
            totalSize: 0,
        }
    },
    methods:{
         //表格格式化方法。prop对应array下标
        tableFormatter(prop,cellValue){
            let valueMap = {
                status:['未退款','已退款'],
            }
            return valueMap[prop]?valueMap[prop][cellValue]:cellValue;
        },
        handleClick(){},
     
        
        searchList(){
             let param = {
              pageNum:this.pageNum,
              pageSize:this.pageSize,
              jobNumber:this.info.jobNumber,
              projectId:this.info.projectId,
            };
            this.axios.post(api.getInvestmentProfitRefunds, param).then(res => {
                if (res.data.code == 200) {
                    let list = res.data.data.list || [];
                    
                    this.tableData = list;
                    this.totalSize = res.data.data.total;
                }
            })
            
        },
        handleCurrentChange () {
            this.searchList()
		},
		handleSizeChange (val) {
			this.pageSize = val
			this.searchList()
		},
	},
	created () {
        this.searchList();
    },
    computed:{
        projectId(){
            return this.info.projectId;
        }
    },
    watch:{
        projectId(val){
            //if(!val && val!==0)return;
            this.searchList();
        }
    },
    props:['info'],
	destroyed() {
		
	},
	filters: {

	}
}

</script>

<style lang="stylus" scoped>


</style>
